package com.onLineCar.management.template;

import com.onLineCar.common.core.domain.Result;

import com.onLineCar.management.domain.TDriver;
import com.onLineCar.management.feign.QueryDriverData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author : 段敏强
 * @className : QueryDriverFeign
 * @description : 描述说明该类的功能
 * @createTime : 2023/12/20 18:53
 */
/**
 * 司机数据服务
 * @author  段敏强
 */
@Component
public class QueryDriverFeign {

    @Autowired
    private QueryDriverData queryDriverData;





    /**
     * 根据司机id获取司机信息
     * @param driverId 司机id
     * @return 司机信息
     */
    public TDriver getDriver(Integer driverId){
        Result<TDriver> tDriverResult = queryDriverData.queryDriverList(driverId);
        if (Result.FAIL == tDriverResult.getCode()){
            throw new RuntimeException("获取司机信息失败");
        }
        return tDriverResult.getData();
    }

}
